	#Title: Programa 22				Filename: 22.s
	#Author: Chipres Castellanos Ana Maria          Date: 23 /mayo / 2017
	#Descripcion:
	#Dada una lista de 30 numeros reordenarlos en orden ascendente
	
	.arch armv6
	.eabi_attribute 27, 3
	.eabi_attribute 28, 1
	.fpu vfp
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 34, 1
	.eabi_attribute 18, 4
	.file	"22.c"
	.section	.rodata
	.align	2
.LC0:
	.ascii	"NUMERO %i: \000"
	.align	2
.LC1:
	.ascii	"%i\000"
	.align	2
.LC2:
	.ascii	"Numeros Ordenados\000"
	.align	2
.LC3:
	.ascii	"%i \012\000"
	.text
	.align	2
	.global	main
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	stmfd	sp!, {r4, r5, r6, fp, lr}
	add	fp, sp, #16
	sub	sp, sp, #36
	mov	ip, sp
	mov	r6, ip
	mov	ip, #10
	str	ip, [fp, #-36]
	ldr	ip, [fp, #-36]
	sub	lr, ip, #1
	str	lr, [fp, #-40]
	mov	lr, ip
	mov	r4, lr
	mov	r5, #0
	mov	r1, r5, asl #5
	orr	r1, r1, r4, lsr #27
	mov	r0, r4, asl #5
	mov	r1, ip
	mov	r0, r1
	mov	r1, #0
	mov	r3, r1, asl #5
	orr	r3, r3, r0, lsr #27
	mov	r2, r0, asl #5
	mov	r3, ip
	mov	r3, r3, asl #2
	add	r3, r3, #3
	add	r3, r3, #7
	mov	r3, r3, lsr #3
	mov	r3, r3, asl #3
	sub	sp, sp, r3
	mov	r3, sp
	add	r3, r3, #3
	mov	r3, r3, lsr #2
	mov	r3, r3, asl #2
	str	r3, [fp, #-44]
	mov	r3, #0
	str	r3, [fp, #-24]
	b	.L2
.L3:
	ldr	r0, .L12
	ldr	r1, [fp, #-24]
	bl	printf
	ldr	r3, [fp, #-24]
	mov	r3, r3, asl #2
	ldr	r2, [fp, #-44]
	add	r3, r2, r3
	ldr	r0, .L12+4
	mov	r1, r3
	bl	__isoc99_scanf
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L2:
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-36]
	cmp	r2, r3
	blt	.L3
	mov	r3, #0
	str	r3, [fp, #-28]
	b	.L4
.L8:
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L5
.L7:
	ldr	r3, [fp, #-44]
	ldr	r2, [fp, #-32]
	ldr	r2, [r3, r2, asl #2]
	ldr	r3, [fp, #-32]
	add	r1, r3, #1
	ldr	r3, [fp, #-44]
	ldr	r3, [r3, r1, asl #2]
	cmp	r2, r3
	blt	.L6
	ldr	r3, [fp, #-44]
	ldr	r2, [fp, #-32]
	ldr	r3, [r3, r2, asl #2]
	str	r3, [fp, #-48]
	ldr	r3, [fp, #-32]
	add	r2, r3, #1
	ldr	r3, [fp, #-44]
	ldr	r1, [r3, r2, asl #2]
	ldr	r3, [fp, #-44]
	ldr	r2, [fp, #-32]
	str	r1, [r3, r2, asl #2]
	ldr	r3, [fp, #-32]
	add	r2, r3, #1
	ldr	r3, [fp, #-44]
	ldr	r1, [fp, #-48]
	str	r1, [r3, r2, asl #2]
.L6:
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
.L5:
	ldr	r2, [fp, #-36]
	ldr	r3, [fp, #-28]
	rsb	r2, r3, r2
	ldr	r3, [fp, #-32]
	cmp	r2, r3
	bgt	.L7
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L4:
	ldr	r2, [fp, #-28]
	ldr	r3, [fp, #-36]
	cmp	r2, r3
	blt	.L8
	ldr	r0, .L12+8
	bl	puts
	mov	r3, #0
	str	r3, [fp, #-24]
	b	.L9
.L10:
	ldr	r3, [fp, #-44]
	ldr	r2, [fp, #-24]
	ldr	r3, [r3, r2, asl #2]
	ldr	r0, .L12+12
	mov	r1, r3
	bl	printf
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L9:
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-36]
	cmp	r2, r3
	blt	.L10
	mov	r3, #0
	mov	sp, r6
	mov	r0, r3
	sub	sp, fp, #16
	@ sp needed
	ldmfd	sp!, {r4, r5, r6, fp, pc}
.L13:
	.align	2
.L12:
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.size	main, .-main
	.ident	"GCC: (Raspbian 4.9.2-10) 4.9.2"
	.section	.note.GNU-stack,"",%progbits
